<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改诊疗单')"/>
    <th:block th:include="include :: select2-css"/>

</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-ncZhenliaoLogs-edit" th:object="${ncZhenliaoLogs}">
        <input id="treeId" name="treeId" type="hidden" value="1"/>
        <!--药品ID-->
        <input id="zlId" name="zlId" th:field="*{zlId}" type="hidden">
        <div class="form-group" hidden="hidden">
            <label class="col-sm-3 control-label">诊疗类型 1:牛舍 2：鸡舍：</label>
            <div class="col-sm-8">
                <input id="zlType" name="zlType" th:field="*{zlType}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group" hidden="hidden">
            <label class="col-sm-3 control-label">状态:1：待确认 2：已挂起 3：已确认：4：已生成订单：</label>
            <div class="col-sm-8">
                <input id="zlStatus" name="zlStatus" th:field="*{zlStatus}" class="form-control" type="text">
            </div>
        </div>
        <!-- <div class="form-group">
             <label class="col-sm-3 control-label">订单id：</label>
             <div class="col-sm-8">
                 <input id="orderId" name="orderId" th:field="*{orderId}" class="form-control" type="text">
             </div>
         </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">耳号：</label>
            <div class="col-sm-8">
                <select id="cowCode" name="cowCode" class="form-control select2-multiple" >
                    <option th:each="cow:${cows}" th:value="${cow}" th:text="${cow}" th:field="*{cowCode}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">圈舍号：</label>
            <div class="col-sm-8">
                <select name="roomNum" class="form-control m-b" th:with="type=${@dict.getType('cow_juanshe_num')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{roomNum}"></option>
                </select>
            </div>
        </div>
        <div class="form-group" hidden="hidden">
            <label class="col-sm-3 control-label">日龄：</label>
            <div class="col-sm-8">
                <input id="ageDays" name="ageDays" th:field="*{ageDays}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label"> 发病次数：</label>
            <div class="col-sm-8">
                <input id="illMuns" name="illMuns" th:field="*{illMuns}" class="form-control" type="number" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">症状：</label>
            <div class="col-sm-8">
                <input id="symptom" name="symptom" th:field="*{symptom}" class="form-control" type="text">
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">推送人：</label>
            <div class="col-sm-8">
                &lt;!&ndash;                <input id="reportUser" name="reportUser" th:field="*{reportUser}" class="form-control" type="text">&ndash;&gt;
                <select id="reportUser" name="reportUser"  >
                    <option th:each="user:${users}" th:value="${user.userId}" th:text="${user.loginName}"
                            th:field="*{reportUser}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">诊疗人员：</label>
            <div class="col-sm-8">
                <select id="zlUser" name="zlUser" >
                    <option th:each="user:${users}" th:value="${user.userId}" th:text="${user.loginName}"
                            th:field="*{zlUser}"></option>
                </select>
            </div>
        </div>
        <div class="form-group" hidden="hidden">
            <label class="col-sm-3 control-label" >诊疗用药id：</label>
            <div class="col-sm-8">
                <input id="drugId" name="drugId" th:field="*{drugId}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">药品名称：</label>
            <div class="col-sm-8">
                <div class="input-group">
                    <input class="form-control" type="text" onclick="selectYaoTree()" id="treeName" readonly="true"  th:field="*{yaoName}" name="yaoName" />
                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">用药方法：</label>
            <div class="col-sm-8">
                <select name="drugMethod" class="form-control m-b" th:with="type=${@dict.getType('animalExecuteType')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">剂量：</label>
            <div class="col-sm-8">
                <input id="drugAmount" name="drugAmount" th:field="*{drugAmount}" class="form-control" type="number">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">单位：</label>
            <div class="col-sm-8">
                <select name="unit" class="form-control m-b" th:with="type=${@dict.getType('unitType')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">诊疗结果：</label>
            <div class="col-sm-8">
                <input id="zlResult" name="zlResult" th:field="*{zlResult}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">诊疗时间：</label>
            <div class="col-sm-8">
                <input id="zlTime" data-format="yyyy-MM-dd HH:mm:ss" required name="zlTime"
                       th:value="*{#dates.format(zlTime, 'yyyy-MM-dd hh:mm:ss')}" class="form-control" type="text"
                       th:class="time-input">
            </div>
        </div>
        &lt;!&ndash; <div class="form-group" hidden="hidden">
             <label class="col-sm-3 control-label">创建者：</label>
             <div class="col-sm-8">
                 <select id="createBy" name="createBy"  multiple>
                     <option th:each="user:${users}" th:value="${user.userId}" th:text="${user.loginName}"
                             th:field="*{createBy}"></option>
                 </select>
             </div>
         </div>&ndash;&gt;
        <div class="form-group">
            <label class="col-sm-3 control-label">创建时间：</label>
            <div class="col-sm-8">
                <input id="createTime" data-format="yyyy-MM-dd HH:mm:ss" required name="createTime"
                       th:value="*{#dates.format(createTime, 'yyyy-MM-dd hh:mm:ss')}" class="form-control" type="text"
                       th:class="time-input">
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea rows="4" name="remark" th:field="*{remark}" class="form-control" type="text"></textarea>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript">
    var prefix = ctx + "system/ncZhenliaoLogs/cow";
    $("#form-ncZhenliaoLogs-edit").validate({
        rules: {
            illMuns: {
                required: true,
                digits: true
            }
        },
        messages: {
            illMuns: "发病次数必须为正整数",
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-ncZhenliaoLogs-edit').serialize());
        }
    }

    function selectYaoTree() {
        var options = {
            title: '药品选择',
            width: "380",
            url: prefix + "/selectYaoTree/"+ $("#treeId").val(),
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }



    function doSubmit(index, layero) {
        var body = layer.getChildFrame('body', index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        $("#drugId").val(body.find('#treeId').val());
        layer.close(index);
    }
</script>
</body>
</html>
